<extend name="public@base5"/>
<block name="main">
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="nav-item">
                <a class="nav-link active" href="{:url('Link/index')}">{:lang('ADMIN_LINK_INDEX')}</a>
            </li>
            <li><a class="nav-link" href="{:url('Link/add')}">{:lang('ADMIN_LINK_ADD')}</a></li>
        </ul>
        <form method="post" class="js-ajax-form margin-top-20" action="admin/links/list/order">
            <div class="table-actions">
                <button class="btn btn-sm btn-primary js-ajax-submit" type="submit"
                        title="{:lang('Sort')}" data-toggle="tooltip">
                    <i class="fa fa-sort-numeric-asc fa-fw"></i>
                </button>
                <button class="btn btn-sm btn-success js-ajax-submit" type="submit"
                        data-action="admin/links/status/1" data-subcheck="true"
                        title="{:lang('DISPLAY')}" data-toggle="tooltip">
                    <i class="fa fa-eye fa-fw"></i>
                </button>
                <button class="btn btn-sm btn-warning js-ajax-submit" type="submit"
                        data-action="admin/links/status/0" data-subcheck="true"
                        title="{:lang('HIDE')}" data-toggle="tooltip">
                    <i class="fa fa-eye-slash fa-fw"></i>
                </button>
            </div>
            <php>$status=array("1"=>lang('DISPLAY'),"0"=>lang('HIDDEN'));</php>
            <table class="table table-hover table-bordered table-list">
                <thead>
                <tr>
                    <th width="16">
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </th>
                    <th width="50">{:lang('SORT')}</th>
                    <th width="50">ID</th>
                    <th>{:lang('NAME')}</th>
                    <th>{:lang('Url')}</th>
                    <th width="50">{:lang('STATUS')}</th>
                    <th width="80">{:lang('ACTIONS')}</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="links" item="vo">
                    <tr>
                        <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x"
                                   name="ids[]"
                                   value="{$vo.id}"></td>
                        <td><input name='list_orders[{$vo.id}]' class="input input-order mr5" type='text' size='3'
                                   value='{$vo.list_order}'></td>
                        <td>{$vo.id}</td>
                        <td>{$vo.name}</td>
                        <td><a href="{$vo.url}" target="_blank">{$vo.url}</a></td>
                        <td>
                            <empty name="vo.status">
                            <span class="badge text-bg-secondary">
                                {$status[$vo['status']]}
                            </span>
                                <else/>
                                <span class="badge text-bg-success">
                                {$status[$vo['status']]}
                            </span>
                            </empty>
                        </td>
                        <td>
                            <a class="btn btn-xs btn-primary"
                               href="{:url('Link/edit',array('id'=>$vo['id']))}"
                               title="{:lang('EDIT')}" data-toggle="tooltip">
                                <i class="fa fa-edit fa-fw"></i>
                            </a>
                            <a class="btn btn-xs btn-danger js-ajax-delete" href="javascript:void(0);"
                               data-href="admin/links/{$vo.id}"
                               title="{:lang('DELETE')}" data-toggle="tooltip">
                                <i class="fa fa-trash fa-fw"></i>
                            </a>
                        </td>
                    </tr>
                </foreach>
                </tbody>
                <tfoot>
                <tr>
                    <th width="16">
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </th>
                    <th width="50">{:lang('SORT')}</th>
                    <th width="50">ID</th>
                    <th>{:lang('NAME')}</th>
                    <th>{:lang('Url')}</th>
                    <th width="50">{:lang('STATUS')}</th>
                    <th width="80">{:lang('ACTIONS')}</th>
                </tr>
                </tfoot>
            </table>
            <div class="table-actions">
                <button class="btn btn-sm btn-primary js-ajax-submit" type="submit"
                        title="{:lang('Sort')}" data-toggle="tooltip">
                    <i class="fa fa-sort-numeric-asc fa-fw"></i>
                </button>
                <button class="btn btn-sm btn-success js-ajax-submit" type="submit"
                        data-action="admin/links/status/1" data-subcheck="true"
                        title="{:lang('DISPLAY')}" data-toggle="tooltip">
                    <i class="fa fa-eye fa-fw"></i>
                </button>
                <button class="btn btn-sm btn-warning js-ajax-submit" type="submit"
                        data-action="admin/links/status/0" data-subcheck="true"
                        title="{:lang('HIDE')}" data-toggle="tooltip">
                    <i class="fa fa-eye-slash fa-fw"></i>
                </button>
            </div>
        </form>
    </div>
</block>